package com.tongji.diy.model
{
	import com.tongji.diy.view.component3D.BaseRoomBorder;
	import com.tongji.diy.view.component3D.RoomBorder;
	import com.tongji.diy.view.component3D.RoomFloor;
	import com.tongji.diy.view.component3D.RoomVertex;
	
	import flash.geom.Point;
	
	/**
	 * 
	 * @author xxj
	 * 
	 */

	public class RoomControlPoint
	{
		//即时值
		protected var _x:Number;
		protected var _y:Number;
		//保存值
		protected var _registerX:Number = 0;
		protected var _registerY:Number = 0;
		
		public var parentRoom:RoomDataVO;
		public var nextBorder:BaseRoomBorder;
		public var prevBorder:BaseRoomBorder;
		public var vertex:RoomVertex;
		public var floor:RoomFloor;
		
		public function RoomControlPoint(point:Point,parentRoom:RoomDataVO)
		{
			this._x = point.x;
			this._y = point.y;
			this.parentRoom = parentRoom;
		}
		
		public function localToGlobal(localPoint:Point):Point
		{
			return parentRoom.roomMatrix.transformPoint(localPoint);
		}
		
		public function get globalX():Number
		{
			return parentRoom.localToGlobal(new Point(_x,_y)).x;
		}
		
		public function get globalY():Number
		{
			return parentRoom.localToGlobal(new Point(_x,_y)).y;
		}
		
		public function get x():Number
		{
			return _x;
		}
		
		public function get y():Number
		{
			return _y;
		}
		
		public function setPosition(position:Point):void
		{
			_x = position.x;
			_y = position.y;
		}
		
		public function get registerX():Number
		{
			return _registerX;
		}
		
		public function get registerY():Number
		{
			return _registerY;
		}
		
		public function register():void
		{
			_registerX = _x;
			_registerY = _y;
		}
	}
}